package com.ffapp.demo.util.update;

import android.content.Context;
import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;

import my.SystemParamsUtils;


public class UpdateBean {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    /**
     * APP版本号
     */
    @JSONField(name = "versions_number")
    private int number;
    /**
     * APP下载地址
     */
    @JSONField(name = "download_url")
    private String url;
    /**
     * APP版本名
     */
    @JSONField(name = "versions_name")
    private String name;
    /**
     * APP版本更新信息
     */
    @JSONField(name = "memo")
    private String info;
    @JSONField(name = "is_force_update")
    private String is_forced_upgrade = "";

    @JSONField(name = "updateTime")
    private String update_time  = "";
    @JSONField(name = "forcedUpgradeVersion")
    private int forced_upgrade_version;

    // private String time;

    public boolean isNeedUpdate(Context mContext) {
        return this.getNumber() > SystemParamsUtils.getAPPVersonCode(mContext);
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInfo() {
        if(TextUtils.isEmpty(info))return "无";
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getIs_forced_upgrade() {
        return is_forced_upgrade;
    }

    public boolean getIs_forced_upgradeBoolean() {
        return is_forced_upgrade.equals("1");
    }

    public void setIs_forced_upgrade(String is_forced_upgrade) {
        this.is_forced_upgrade = is_forced_upgrade;
    }

    public int getForced_upgrade_version() {
        return forced_upgrade_version;
    }

    public void setForced_upgrade_version(int forced_upgrade_version) {
        this.forced_upgrade_version = forced_upgrade_version;
    }


    public String getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }
}
